<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./TemplatePrincipal.xhtml">

          
            <ui:define name="content">
                <f:view>
                    <p:panel header="lista de ventas">
                    <h:form>
                        <p:commandButton action="VentaCrearEditar" value="agregar venta" actionListener="#{salesBean.prepararNuevo}" ajax="false"/>
                        <p:commandButton action="MenuPrincipal" value="menu principal" ajax="false"/>
                      
                        <p:dataTable value="#{salesBean.lista}" var="item">
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Idventa"/>
                                </f:facet>
                                <h:outputText value="#{item.idventa}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Fecha"/>
                                </f:facet>
                                <h:outputText value="#{item.fecha}">
                                    <f:convertDateTime pattern="dd/MM/yy" />
                                </h:outputText>
                            </p:column>
                            
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Idvendedor"/>
                                </f:facet>
                                <h:outputText value="#{item.vendedorIdvendedor}"/>
                            </p:column>
                             <p:column>
                                <f:facet name="header">
                                    <h:outputText value="eliminar"/>
                                </f:facet>
                                 <p:commandButton value="eliminar" actionListener="#{salesBean.prepararEliminar}" ajax="false"/>
                            </p:column>
                            
                        </p:dataTable>
                        
                    </h:form>
                        </p:panel>
                </f:view>

            </ui:define>

        </ui:composition>

    </body>
</html>
